package com.graduation.smartparkingplatform.ServiceImpl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.graduation.smartparkingplatform.Dao.DistinguishMapper;
import com.graduation.smartparkingplatform.Pojo.Distinguish;
import com.graduation.smartparkingplatform.Service.DistinguishService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class DistinguishServiceImpl implements DistinguishService {

  @Autowired DistinguishMapper distinguishMapper;

  // 获取识别记录列表（分页）
  @Override
  public PageInfo<Distinguish> getdistinguishList(Integer page, Integer count) {
    PageHelper.startPage(page, count);

    List<Distinguish> getdistinguishList = distinguishMapper.getdistinguishList();

    PageInfo<Distinguish> pageInfo = new PageInfo<>(getdistinguishList);

    return pageInfo;
  }

  // 模糊搜索识别记录（分页）
  @Override
  public PageInfo<Distinguish> searchDistinguish(
      Integer page,
      Integer count,
      String distinguishType,
      String carPlate,
      String distinguishTime) {
    PageHelper.startPage(page, count);

    List<Distinguish> distinguishList =
        distinguishMapper.searchDistinguish(distinguishType, carPlate, distinguishTime);

    PageInfo<Distinguish> pageInfo = new PageInfo<>(distinguishList);

    return pageInfo;
  }

  // 删除识别记录
  @Override
  public Boolean deleteDistinguish(Integer DistinguishId) {
    return distinguishMapper.deleteDistinguish(DistinguishId);
  }

  // 获取所有识别记录
  @Override
  public List<Distinguish> getdistinguishListAll() {
    return distinguishMapper.getdistinguishListAll();
  }
}
